package com.prj.ufdm.cloud.svr.gateway.constant;

import javax.annotation.Resource;

import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.env.Environment;

@Configuration
public class WebMsUrlConstants implements EnvironmentAware{
	
	@Resource
	private Environment env;
	
	public static String MS_AUTH_URI;
	public static String MS_ORDER_URI;
	public static String MS_WAREHOUSE_URI;
	
	// 获取系统所有功能
	public static String GET_FUNCTION_LIST_URL;
	// 获取个人所拥有的功能
	public static String GET_FUNCTION_LIST_BY_USER_ID_URL;
	// 修改用户
	public static String MODIFY_SYSUSER_URL;
	// 根据用户名查询用户
	public static String GET_SYSUSER_BY_USERNAME_URL;
	// 根据Token查询用户
	public static String GET_SYSUSER_BY_TOKEN_URL;
	
	// 功能相关操作,为了刷新缓存使用
	public static String METASOURCE_GET_URL = "/api/auth/sysfun/doGetLayerFunctionObject";
	public static String METASOURCE_ADD_URL = "/api/auth/sysfun/doSaveFunction";
	public static String METASOURCE_UPDATE_URL = "/api/auth/sysfun/doModFunction";
	public static String METASOURCE_DEL_URL = "/api/auth/sysfun/doDelFunction";
	
	
	@Override
	public void setEnvironment(Environment environment) {
		
		MS_AUTH_URI =  environment.getProperty("ms.auth.uri");
		MS_ORDER_URI = environment.getProperty("ms.order.uri");
		MS_WAREHOUSE_URI = environment.getProperty("ms.warehouse.uri");
		
		GET_FUNCTION_LIST_URL = "http://" + MS_AUTH_URI + "/api/auth/sysfun/doGetFunctionList";
		GET_FUNCTION_LIST_BY_USER_ID_URL = "http://" + MS_AUTH_URI + "/api/auth/sysfun/doGetFunctionListByUserId";
		MODIFY_SYSUSER_URL = "http://" + MS_AUTH_URI + "/api/auth/sysuser/doMod";
		GET_SYSUSER_BY_USERNAME_URL = "http://" +MS_AUTH_URI + "/api/auth/sysuser/doGetSysUserByUserName";
		GET_SYSUSER_BY_TOKEN_URL = "http://" +MS_AUTH_URI + "/api/auth/sysuser/doGetSysUserByToken";
		
	}

}
